package com.zsq.thread.test2;

/**
 * @author : zhang sq
 * @date : 2019/12/25 21:36
 **/
//volatile 修正
public class Sync3 implements Runnable{
    private /*volatile*/ long count = 50;

    @Override
    public /*synchronized*/ void run() {
        count--;
        System.out.println(Thread.currentThread().getName() + "count=" + count);
    }

    public static void main(String[] args) {
        Sync3 sync3=new Sync3();
        for (int i = 0; i < 50; i++) {
            new Thread(sync3,"Thread"+i).start();
        }
    }
}
